package com.example.historyHour.DAO;

import com.example.historyHour.Entity.HistoryHourEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Studio on 2017/5/19.
 */
@Repository
public interface HistoryHourDAO extends JpaRepository<HistoryHourEntity,Integer> {
    @Query(value = "insert into history_hour_0?(created,device_id,property,value) VALUES(?,?,'Systempress',0),(?,?,'Exhaustpress',0),(?,?,'Oilpress',0),(?,?,'Systemtemp',0),(?,?,'Exhausttemp',0),(?,?,'Fbearingtemp',0),(?,?,'Bbearingtemp',0),(?,?,'Acurrent',0),(?,?,'Bcurrent',0),(?,?,'Ccurrent',0),(?,?,'WindingTemp1',0),(?,?,'WindingTemp2',0),(?,?,'InWaterTempT',0),(?,?,'OutWaterTemp',0),(?,?,'FirstExhaustTemp',0),(?,?,'OilTemp',0),(?,?,'FirstExhaustPress',0),(?,?,'Inletpress',0),(?,?,'HostFreq',0),(?,?,'FansFreq',0),(?,?,'EnvTemperature',0),(?,?,'EnvHumidity',0)",nativeQuery = true)
    @Modifying
    @Transactional
    public void insterHistory0(int m,long created1 , String device_id1,long created2 , String device_id2,long created3 , String device_id3,long created4 , String device_id4,long created5,String device_id5,long created6,String device_id6,long created7 , String device_id7,long created8,String device_id8,long created9,String device_id9,long created10,String device_id10,long created11,String device_id11,long created12,String device_id12,long created13,String device_id13,long created14,String device_id14,long created15,String device_id15,long created16,String device_id16,long created17,String device_id17,long created18,String device_id18,long created19,String device_id19,long created20,String device_id20,long created21,String device_id21,long created22,String device_id22);


    @Query(value = "insert into history_hour_?(created,device_id,property,value) VALUES(?,?,'Systempress',0),(?,?,'Exhaustpress',0),(?,?,'Oilpress',0),(?,?,'Systemtemp',0),(?,?,'Exhausttemp',0),(?,?,'Fbearingtemp',0),(?,?,'Bbearingtemp',0),(?,?,'Acurrent',0),(?,?,'Bcurrent',0),(?,?,'Ccurrent',0),(?,?,'WindingTemp1',0),(?,?,'WindingTemp2',0),(?,?,'InWaterTempT',0),(?,?,'OutWaterTemp',0),(?,?,'FirstExhaustTemp',0),(?,?,'OilTemp',0),(?,?,'FirstExhaustPress',0),(?,?,'Inletpress',0),(?,?,'HostFreq',0),(?,?,'FansFreq',0),(?,?,'EnvTemperature',0),(?,?,'EnvHumidity',0)",nativeQuery = true)
    @Modifying
    @Transactional
    public void insterHistory1(int m,long created1 , String device_id1,long created2 , String device_id2,long created3 , String device_id3,long created4 , String device_id4,long created5,String device_id5,long created6,String device_id6,long created7 , String device_id7,long created8,String device_id8,long created9,String device_id9,long created10,String device_id10,long created11,String device_id11,long created12,String device_id12,long created13,String device_id13,long created14,String device_id14,long created15,String device_id15,long created16,String device_id16,long created17,String device_id17,long created18,String device_id18,long created19,String device_id19,long created20,String device_id20,long created21,String device_id21,long created22,String device_id22);

}
